package mysql

import "gorm.io/gorm"

type Order struct {
	gorm.Model
	UserId   int     `gorm:"type:int(11);not null;comment:'用户id'"`
	OrderSn  string  `gorm:"type:varchar(50);not null;comment:'订单号'"`
	Name     string  `gorm:"type:varchar(11);not null;comment:'酒店名称'"`
	RoomType int     `gorm:"type:int(11);not null;comment:'房型: 1:大床房 2:双床房 3:家庭房'"`
	People   string  `gorm:"type:varchar(11);not null;comment:'入住人'"`
	Times    string  `gorm:"type:varchar(20);not null;comment:'入/离时间'"`
	Price    float64 `gorm:"type:double(10,2);not null;comment:'价格'"`
	Person   string  `gorm:"type:varchar(20);not null;comment:'负责人'"`
	Types    int     `gorm:"type:int(20);not null;comment:'状态: 1:待发送 2:待支付 3:待确认 4:待完成'"`
}

func (o *Order) Create(order *Order) error {
	return DB.Debug().Create(&order).Error
}

func (o *Order) OrderList() (result []*Order, err2 error) {
	DB.Debug().Find(&result)
	return
}
